package com.quickstart.user.service;

import com.quickstart.entity.UserEntity;
import com.quickstart.user.dao.UserMapper;
import com.quickstart.user.form.UserForm;
import com.quickstart.user.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:wesley
 */
@Service
public class UserService {


    @Autowired
    private UserMapper userMapper;


    public UserEntity getUserById(Integer id){
        return  userMapper.selectByPrimaryKey(id);
    }


    public List<UserModel> getUserList(UserForm userForm){
        return userMapper.getUserList(userForm);
    }

    public int update(UserEntity userEntity){
        return userMapper.updateByPrimaryKeySelective(userEntity);
    }

    public int save(UserEntity userEntity){
        return userMapper.insert(userEntity);
    }

}
